package src.com.hpu.tools;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;

import com.hpu.bean.RoomBean;

import android.content.Context;

public class RoomTools {

	public static List<RoomBean> loadInstitude(Context context,String file){
		List<RoomBean> list = new ArrayList<>();
		try {
			InputStreamReader is=new InputStreamReader(context.getAssets().open(file), "UTF-8");
			BufferedReader reader = new BufferedReader(is);
			String lineTxt = null;
			while ((lineTxt = reader.readLine()) != null) {
				if(lineTxt.charAt(0)!=';'){
					String[] arr=lineTxt.split(";");
					list.add(new RoomBean(arr[0],arr[1]));
				}
				
			}
			reader.close();
			is.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return list;
	}

}
